home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 145
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan).7z
/
Gekkan Dennou Club - 2000.6 Vol. 145 (Japan) (Track 1).bin
/
games
/
spassion
/
source.lzh
/
SOURCE
/
OPEN_END.C
< prev
next >
Wrap
Text File
|
2000-03-31
|
14KB
|
564 lines
/* オープニングとエンディング */
#include <stdio.h>
#include <string.h>
#include <doslib.h>
#include <iocslib.h>
#include <math.h>
#include <apic.h>
#include <XSP2lib.H>
#include "SPASSION.H"
#include "PLAYER.H"
#include "SHOT.H"
#include "PRIORITY.H"
#include "BG.H"
#include "SOUND.H"
#include "SUB.H"
#define SP_X( x ) (*((short *)(&x))); /*lxの上位ワード*/
#define SP_Y( y ) (*((short *)(&y))); /*lyの上位ワード*/
#define PLAYER_DIR1 6
#define PLAYER_DIR2 12
#define APP_PT 12
void ras_scroll() ;
void ras_scroll_init() ;
XSP_TIME_CHART time_chart[512] ; /* ユーザー側ラスター割り込みタイムチャート */
static short wave[ 256 ] ; /* うねりデーター */
static short wave_ptr = 0 ; /* うねりデーター読み出し位置のインデックス */
static short wave_ptr_00 = 0 ; /* うねりデーター読み出し位置のインデックスの初期値 */
/* オープニングで使う文章用 */
typedef struct SENTENCE{
char *str; /* 文章 */
short info; /* 1で中央寄せする */
}SENTENCE;
/* 文字列を真ん中に揃えて表示 */
void printf_( SENTENCE *sentence )
{
short lng,x,i;
char str[255];
if(sentence->info){
lng=strlen(sentence->str);
x=(32-lng/2)/2;
for(i=0;i<x;i++)
FPUTS(" ",2); /*空白を作る*/
if( (32-lng/2)%2 )
FPUTC(' ',2); /*空白を作る*/
}
sprintf(str,"%s",sentence->str);
FPUTS(str,2);
}
void Opening( void )
{
short ty=512,i=0,j,cur_y=0,cur_y2=1,count=0;
unsigned short *p=(unsigned short *)0xE80016;
SENTENCE opening_str[]={
/* " ",*/
"「Active Shoot」から数カ月、彼の就職活動は、",1,
"",0,
"",0,
"未だに収束の気配すら見せずにいた。",1,
"",0,
"",0,
"",0,
"",0,
"「おっ、××社からの郵便だ。なになに? 『残念ながらご希望に沿",0,
"",0,
" うことが出来ず・・・』 キーッ! あたしの作品のどこが気に入",0,
"",0,
" らないっていうの! くやしー!」",0,
"",0,
" 齢24を過ぎ、さすがの彼も焦っていた。",0,
"",0,
"",0,
"",0,
"",0,
" 彼は言う。",1,
"",0,
"就職、それは",1,
"",0,
"夢をかなえるための手段に過ぎないと。",1,
"",0,
"",0,
"「就職しないと御飯が食べられないし、彼女もできないし、",0,
"",0,
" ていうか零式が買えないじゃないか。」",0,
"",0,
"",0,
"彼は願う。",1,
"",0,
"自分の作ったゲームで、",1,
"",0,
"子供達が目を輝かせてくれることを。",1,
"",0,
"",0,
"「○○も、△△も、果ては××まで門前払いとは・・・。",0,
"",0,
" 面接ぐらいさせてくれたっていいじゃねーか・・・",0,
"",0,
" ぶつぶつ・・・。」",0,
"",0,
"",0,
"そして今、新たに完成した作品を引っ提げ、",1,
"",0,
"未来への一歩を踏み出す。",1,
"",0,
"",0,
"「俺を採用しなかったことを後悔させてやる!」",1,
"",0,
"",0,
"",0,
"",0,
" 途中、WinでDirectXなんぞに手を染めたりもしながら、",1,
"",0,
"しつこくX68kで作品を作り続けるのであった。",1,
"",-1
};
void VdispRoutine( void );
/*-----[ ユーザー側ラスター割り込みタイムチャート作成 ]-----*/
i=0 ;
for ( j=0 ; j<512 ; j+=8 )
{
time_chart[i].ras_no = j*2+32 ;
time_chart[i].proc = ras_scroll ;
i++ ;
}
time_chart[i].ras_no = -1 ; /* エンドマーク */
/*--------[ ラスタースクロール用うねりデーター作成 ]--------*/
/* for ( i=0 ; i<512 ; i++ )*/
for ( i=0 ; i<256 ; i++ )
{
wave[i] = sin( 3.1415926535898 * (double)i/128 ) * 128 ;
}
CRTMOD( 12 ); /* 512*512dot 655366色 グラフィックプレーン1枚 31kHz */
G_CLR_ON();
B_CONSOL(0, 0, 127, 63);
CONTRAST(0);
VPAGE(0); /* 表示を消す */
APAGE(0);apic_load("PIC/OPENING.PIC",0,0);
xsp_vsyncint_on( ras_scroll_init ) ; /* 帰線期間割り込み開始 */
xsp_hsyncint_on( time_chart ) ; /* ラスター割り込み開始 */
VPAGE(1); /* 表示 */
xsp_vsync( 30 ); /* 時間稼ぎ */
PlayBGM( MUSIC_OPENING ); /* 音楽 */
while( CONTRAST(-1) != 15 ){
CONTRAST(++i);
xsp_vsync( 8 );
}
xsp_vsync( 60 ); /* 時間稼ぎ */
i=0;
*p=ty; /* スクロール値設定 */
while( !(GetKeyM( 0 ) & 0xF0) ){ /* ジョイスティックのボタンが押されたら出る */
if( !(ty%16) ){
if( opening_str[i].info != -1 ){
B_LOCATE(0,cur_y);
printf_(&opening_str[i++]);
B_LOCATE(0,cur_y2);
B_ERA_AL(); /* クリア */
cur_y++;
cur_y&=63;
cur_y2=cur_y+1;
cur_y2&=63;
}else{
B_LOCATE(0,cur_y2);
B_ERA_AL(); /* クリア */
cur_y2++;
cur_y2&=63;
count++;
}
}
xsp_vsync( 3 );
ty++; /* スクロール値を増やす */
ty&=1023;
*p=ty;
if( count > 32 )break; /* 最終行がスクロールし終えた */
}
FadeOut( 96 );
for(i=15;i>0;i--){
CONTRAST(i);
xsp_vsync( 2 );
}
xsp_vsync( 60 );
xsp_vsyncint_off();
xsp_hsyncint_off();
}
/*
帰線期間割り込みサブルーチン
*/
void ras_scroll_init()
{
wave_ptr = wave_ptr_00 ;
/* wave_ptr_00 =(wave_ptr_00 + 1) & 511 ;*/
wave_ptr_00 =(wave_ptr_00 + 1) & 255 ;
}
/*
ラスター割り込みサブルーチン
*/
void ras_scroll()
{
*(short *)(0xE80018) = wave[ wave_ptr ] ; /* グラフィックプレーン0 X座標 */
/* wave_ptr = (wave_ptr + 1) & 511 ;*/
wave_ptr = (wave_ptr + 1) & 255 ;
}
/* エンディングで使う文字列用 */
typedef struct STR{
short x,y; /* 座標 */
char *str; /* 文字列 */
}STR;
void MoveStr( STR *str, short i )
{
short lng,gx,y;
lng =strlen(str->str);
gx =(16-lng)*10/2*16/10; /* 小数対応のため10倍している。実際は (16-lng)/2*16 */
y =str->y;
if( i%2 ){
if( (str->x+=2) > gx )
str->x=gx;
}else{
if( (str->x-=2) < gx )
str->x=gx;
}
PutBGStr( str->x, y, str->str, INFO_MOJI);
}
void ChangeStage( short stage )
{
unsigned short *pal=(unsigned short *)0xE82220;
short i;
char *stage_pic[STAGES*2]={
"PIC/STAGE1_0.PIC","PIC/STAGE1_1.PIC",
"PIC/STAGE2.PIC", "PIC/STAGE2.PIC",
"PIC/STAGE3_0.PIC","PIC/STAGE3_1.PIC",
"PIC/STAGE4_0.PIC","PIC/STAGE4_1.PIC",
};
BGCTRLST(1, 1, 0); /* BG1表示OFF */
VPAGE(0); /* 表示を消す */
HOME( 0, 0 ,0 );
HOME( 1, 0 ,0 );
APAGE(1);apic_load(stage_pic[stage*2] ,0,0);
APAGE(0);apic_load(stage_pic[stage*2+1],0,0);
VPAGE(3); /* 表示 */
for(i=0;i<16;i++)
*(pal++)=bg_pal[stage][i];
for(i=0;i<256;i++)
SP_DEFCG(i, 0, &bg_sp[stage][i*32]);
SetBG(32*3,0);
BGCTRLST(1, 1, 1); /* BG1表示ON */
gr1_x=0; gr1_y=0; gr1_vx=-32768;gr1_vy=0;
gr2_x=0; gr2_y=0; gr2_vx=-21845;gr2_vy=0;
map_x=(32*3*8)<<16;map_y=0;map_vx=-DOT_RATE/4;map_vy=0;
player[0].lx = (256+32+16)<<16;
player[0].ly = (128+16)<<16;
player[0].vx = -65536/2;
player[0].state = 0;
player[1].lx = (256+32+16)<<16;
player[1].ly = (128+16)<<16;
player[1].vx = -65536/2;
player[1].state = 0;
}
/* ステージを戻る */
void Ending( void )
{
short st=0,end,end_timer=0,str_state,player_flag;
char button=0,break_flag=0;
short count=0,i=0,con,con_count;
void ChangeZPD( short num );
short MovePlayerEnding( PLAYER *player );
void Disp( void );
STR ending_str[STAGES][16]={
{
{ 0, 5*16,"Special"},
{ 0, 6*16,"Thanks"},
{ 0, 8*16,"F.Yosshin"},
{ 0, 9*16,"&XSP System"},
{ 0, 0,"_"},
{ 0, 5*16,"Thank You"},
{ 0, 7*16,"For"},
{ 0, 9*16,"Playing!"},
{ 0, 0,NULL},
},
{
{ 0, 5*16,"OpeningGraphic"},
{ 0, 7*16,"Shinnichi Sato"},
{ 0, 9*16,"Program"},
{ 0,11*16,"Koji Sato"},
{ 0, 0,NULL},
},
{
{ 0, 3*16,"Music"},
{ 0, 5*16,"Mark44."},
{ 0, 6*16,"H.Mizuno"},
{ 0, 8*16,"SoundEffect"},
{ 0,10*16,"H.Suzuki"},
{ 0,11*16,"K.Matsumoto"},
{ 0,12*16,"Quoz"},
{ 0,13*16,"SJOM"},
{ 0,14*16,"&Others"},
{ 0, 0,NULL},
},
{
{ 0, 4*16,"Sprite"},
{ 0, 6*16,"MSY."},
{ 0, 7*16,"M.N.B.S"},
{ 0, 9*16,"BG&Font"},
{ 0,11*16,"MSY."},
{ 0, 0,NULL},
}
};
player[0].pt = obj_player+2;
player[0].info = 0x4000|PALET_PLAYER|PRIORITY_PLAYER;
player[0].option[0].info = 0x4000|PALET_PLAYER|PRIORITY_PLAYER;
player[0].option[1].info = 0x4000|PALET_PLAYER|PRIORITY_PLAYER;
if( play_mode == MODE_2P ){
player[1].pt = obj_player+2;
player[1].info = 0x4000|PALET_PLAYER|PRIORITY_PLAYER;
player[1].option[0].info = 0x4000|PALET_PLAYER|PRIORITY_PLAYER;
player[1].option[1].info = 0x4000|PALET_PLAYER|PRIORITY_PLAYER;
}
/* ChangeZPD( 1 );*/ /*エンディング用のZPDファイル*/
xsp_vsync( 90 );
PlayBGM( MUSIC_ENDING );
/* スタッフロール */
for(;stage>=0;stage--){
ChangeStage( stage );
for(i=0;ending_str[stage][i].str;i++){ /* 文字列表示 */
short lng,gx;
lng =strlen(ending_str[stage][i].str);
gx =(16-lng)*10/2*16/10; /* 小数対応のため10倍している。実際は (16-lng)/2*16 */
if( i%2 )
ending_str[stage][i].x=gx-256;
else
ending_str[stage][i].x=gx+256;
}
str_state=0;player_flag=0;end=1;con=0;con_count=0;
while( 1 ){
switch (str_state){
case 0: /* 文字列入場 */
for(i=st;i<end;i++) /* 文字列表示 */
MoveStr( &ending_str[stage][i], i );
if( ++end_timer>60 ){ /* 最後の文字列が出てから1秒たった */
end++;
end_timer=0;
if(!ending_str[stage][end].str || ending_str[stage][end].str[0]=='_')
str_state++;
}
break;
case 1: /* 入場し終えるのを待つ */
for(i=st;i<end;i++) /* 文字列表示 */
MoveStr( &ending_str[stage][i], i );
if( ++end_timer>60*4 ){ /* 最後の文字列が出てから4秒たった */
end_timer=0;
end=st+1;
str_state++;
}
break;
case 2: /* 文字列退場 */
for(i=st;i<end;i++){
if( i%2 )
ending_str[stage][i].x+=2;
else
ending_str[stage][i].x-=2;
}
for(i=st;
ending_str[stage][i].str && ending_str[stage][i].str[0]!='_';
i++) /* 文字列表示 */
/* for(i=st;i<end;i++)*/ /* 文字列表示 */
PutBGStr( ending_str[stage][i].x, ending_str[stage][i].y, ending_str[stage][i].str, INFO_MOJI);
if( ++end_timer>30 ){ /* 最後の文字列が出てから0.5秒たった */
end++;
end_timer=0;
if(!ending_str[stage][end].str || ending_str[stage][end].str[0]=='_')
str_state++;
}
break;
case 3: /* 退場し終えるのを待つ */
for(i=st;i<end;i++){
if( i%2 )
ending_str[stage][i].x+=2;
else
ending_str[stage][i].x-=2;
}
for(i=st;i<end;i++) /* 文字列表示 */
PutBGStr( ending_str[stage][i].x, ending_str[stage][i].y, ending_str[stage][i].str, INFO_MOJI);
if( ++end_timer>60*2 ){ /* 最後の文字列が出てから2秒たった */
end_timer=0;
if( !ending_str[stage][end].str ){
st=0;
str_state++;
}else{
st=end+1;
str_state=0;
}
end=st+1;
}
break;
}
if( !MovePlayerEnding( &player[0] )) /* 1P自機移動 */
player_flag=1;
if( play_mode == MODE_2P )
MovePlayerEnding( &player[0] ); /* 2P自機移動 */
if( player_flag && str_state > 3 ){
con=(con_count--)/4;
CONTRAST(con);
if( !CONTRAST(-1) )
break;
}else{
/* if( con!=15 ){
con=(con_count++)/4;
CONTRAST(con);
}else{
con=15;con_count=15*4;
}
*/
if( con!=15 ){
con++;
CONTRAST(con);
}else{
con=15;con_count=15*4;
}
}
bg_x=(map_x>>16)&0x1FF;
bg_y=(map_y>>16)&0x1FF;
ScrollBG(); /* BGスクロール */
map_x+=map_vx;
gr1_x+=gr1_vx;gr1_y+=gr1_vy; /* 背景スクロール */
gr2_x+=gr2_vx;gr2_y+=gr2_vy;
Disp();
if( count++ > 60*3 ){
count=60*3;
button=GetKeyM( player[0].num )&0xF0;
if( button ){ /* キーが押されたら出る */
break_flag=1;
break;
}
}
}
if(break_flag)break;
}
FadeOut( 96 );
con=15;
while( CONTRAST(-1) != 0 ){
xsp_vsync( 4 );
CONTRAST(--con);
}
CONTRAST(15);
}
/* 画面右から中央へ、上を回って左へ */
short MovePlayerEnding( PLAYER *player )
{
unsigned char pt_dir,i;
/* 移動量を足す */
player->lx+=player->vx;
player->ly+=player->vy;
player->x = (*((short *)(&player->lx))); /*lxの上位ワード*/
player->y = (*((short *)(&player->ly))); /*lyの上位ワード*/
if( player->vy < 0 ){
if( player->dir > -PLAYER_DIR2-6 )player->dir--;
}else if( player->vy > 0 ){
if( player->dir < PLAYER_DIR2+6 )player->dir++;
}else{
if( player->dir > 0 )player->dir--;
else player->dir++;
}
if( player->dir > PLAYER_DIR2 ) pt_dir=4;
else if( player->dir > PLAYER_DIR1 )pt_dir=3;
else if( player->dir > -PLAYER_DIR1 )pt_dir=2;
else if( player->dir > -PLAYER_DIR2 )pt_dir=1;
else pt_dir=0;
player->pt=obj_player+pt_dir;
switch( player->state ){
case 0: /* 右から中央 */
if( player->x < 128+16 ){
player->vy = -65536/4;
player->state++;
}
break;
case 1: /* ちょっと後退 */
player->vx += 256;
if( player->vx > 0 ){
if( player->vx > 65536/4 ){
player->state++;
player->vy = 0;
}
}
break;
case 2: /* 左へ */
player->vx -= 1024;
if( player->x < -32+16 )
return 0;
if( PLAYER_X < 32+16 )
player->pt=obj_player+APP_PT+3;
else if( PLAYER_X < 64+16 )
player->pt=obj_player+APP_PT+2;
else if( PLAYER_X < 96+16 )
player->pt=obj_player+APP_PT+1;
else if( PLAYER_X < 128+16 )
player->pt=obj_player+APP_PT+0;
break;
}
/* オプション */
if( player->option_anim_count==0 )
player->option_anim_count=4;
else
player->option_anim_count=0;
player->option[0].lx=player->old_lx[(player->pointer-4) & 255];
player->option[0].ly=player->old_ly[(player->pointer-4) & 255]-24*DOT_RATE;
player->option[1].lx=player->old_lx[(player->pointer-4) & 255];
player->option[1].ly=player->old_ly[(player->pointer-4) & 255]+24*DOT_RATE;
for(i=0;i<2;i++){
player->option[i].pt=obj_option+pt_dir/2+player->option_anim_count;
player->option[i].x = (*((short *)(&player->option[i].lx)))-8; /*lxの上位ワード*//*-8は表示位置をずらすため*/
player->option[i].y = (*((short *)(&player->option[i].ly)))-8; /*lyの上位ワード*/
xsp_set_st( &player->option[i] );
}
player->old_lx[player->pointer]=player->lx;
player->old_ly[player->pointer]=player->ly;
player->pointer++;
player->pointer&=255;
xobj_set_st( player );
return 1;
}